﻿using OpenTK;

namespace Chimp.Core.Actors
{
    public class ActorImage : ChimpBase
    {
        public float H;
        public Vector2[] OPos = new Vector2[1024];
        public float[] ORot = new float[1024];
        public float[] OScale = new float[1024];
        public float W;
        public ActorImage(string path,int w,int h)
        {
            W = w;
            H = h;
            Image = new ChimpTexture2D(path);
            ImageColor = new Vector4(1,1,1,1);
            ImageBlend = ChimpBlend.Alpha;
        }
        public ActorImage(ChimpTexture2D img, int w, int h)
        {
            W = w;
            H = h;
            Image = img;
            ImageColor = new Vector4(1, 1, 1, 1);
            ImageBlend = ChimpBlend.Alpha;

        }

        public ChimpTexture2D Image { get; set; }
        public Vector4 ImageColor { get; set; }
        public ChimpBlend ImageBlend { get; set; }
        public override void OnDraw(Vector2 pos)
        {
            //pos += DrawPos;
            pos = DrawPos;
            ChimpDraw.BlendMode = ImageBlend;
            ChimpDraw.Image(new Vector4(pos.X - W/2, pos.Y - H/2, W, H), DrawRotation, DrawScale, ImageColor, Image,
                            true);
        }

        public override void OnDrawShape(Vector2 pos)
        {
            ChimpDraw.ShapeBlit(new Vector4(DrawPos.X - W/2, DrawPos.Y - H/2, W, H), DrawRotation, DrawScale, Image,
                                true);
        }
    }
}